local ____lualib = require("lualib_bundle")
local __TS__New = ____lualib.__TS__New
local __TS__Class = ____lualib.__TS__Class
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
local __TS__SourceMapTraceBack = ____lualib.__TS__SourceMapTraceBack
__TS__SourceMapTraceBack(debug.getinfo(1).short_src, {["9"] = 1,["10"] = 1,["11"] = 3,["12"] = 3,["13"] = 4,["14"] = 4,["15"] = 6,["16"] = 8,["17"] = 13,["18"] = 13,["19"] = 13,["20"] = 13,["21"] = 17,["22"] = 13,["23"] = 19,["24"] = 19,["25"] = 19,["26"] = 20,["27"] = 17,["32"] = 51,["40"] = 58,["48"] = 65,["56"] = 72,["64"] = 79,["65"] = 80,["66"] = 81,["68"] = 83,["72"] = 27,["73"] = 28,["74"] = 29,["75"] = 29,["76"] = 29,["77"] = 29,["78"] = 27,["79"] = 35,["80"] = 36,["81"] = 36,["82"] = 36,["83"] = 36,["84"] = 35,["85"] = 42,["86"] = 43,["87"] = 44,["88"] = 44,["89"] = 44,["90"] = 44,["91"] = 42,["92"] = 89,["93"] = 90,["94"] = 89,["95"] = 96,["96"] = 97,["97"] = 96,["98"] = 103,["99"] = 104,["100"] = 103,["101"] = 110,["102"] = 111,["103"] = 110,["104"] = 118,["105"] = 119,["106"] = 118});
local ____exports = {}
local ____player = require("kernel.@types.player")
local KPlayerStatus = ____player.KPlayerStatus
local ____cache = require("kernel.util.cache")
local Cache = ____cache.default
local ____AbstractData = require("kernel.interfaces.AbstractData")
local AbstractData = ____AbstractData.default
local cache = __TS__New(Cache)
local handle = 0
____exports.default = __TS__Class()
local KPlayer = ____exports.default
KPlayer.name = "KPlayer"
__TS__ClassExtends(KPlayer, AbstractData)
function KPlayer.prototype.____constructor(self, role)
    AbstractData.prototype.____constructor(self)
    local ____handle_0 = handle
    handle = ____handle_0 + 1
    self.handleId = ____handle_0
    self.handle = role
end
__TS__SetDescriptor(
    KPlayer.prototype,
    "id",
    {get = function(self)
        return self.handle:get_role_id_num()
    end},
    true
)
__TS__SetDescriptor(
    KPlayer.prototype,
    "campId",
    {get = function(self)
        return self.handle:get_camp_id_num()
    end},
    true
)
__TS__SetDescriptor(
    KPlayer.prototype,
    "camp",
    {get = function(self)
        return self.handle:api_get_camp()
    end},
    true
)
__TS__SetDescriptor(
    KPlayer.prototype,
    "name",
    {get = function(self)
        return self.handle:get_role_name()
    end},
    true
)
__TS__SetDescriptor(
    KPlayer.prototype,
    "status",
    {get = function(self)
        local value = self.handle:get_role_status()
        if value == 1 then
            return KPlayerStatus.Playing
        end
        return KPlayerStatus.Offline
    end},
    true
)
function KPlayer.fromId(self, id)
    local role = gameapi.get_role_by_role_id(id)
    return cache:get(
        "player:" .. tostring(id),
        function() return __TS__New(____exports.default, role) end
    )
end
function KPlayer.fromRole(self, role)
    return cache:get(
        "player:" .. tostring(role:api_get_role_id()),
        function() return __TS__New(____exports.default, role) end
    )
end
function KPlayer.fromLocal(self)
    local role = gameapi.get_client_role()
    return cache:get(
        "player:" .. tostring(role:api_get_role_id()),
        function() return __TS__New(____exports.default, role) end
    )
end
function KPlayer.prototype.setMouseClickSelection(self, status)
    self.handle:set_role_mouse_left_click(status)
end
function KPlayer.prototype.setMouseMoveSelection(self, status)
    self.handle:set_role_mouse_move_select(status)
end
function KPlayer.prototype.setMouseWheel(self, status)
    self.handle:set_role_mouse_wheel(status)
end
function KPlayer.prototype.destroy(self)
    self.data:clear()
end
function KPlayer.prototype.selectUnit(self, target)
    self.handle:role_select_unit(target.handle)
end
return ____exports
